<html>

<head>
  <script language="javascript" type="text/javascript" src="__PUBLIC__/contract/jquery-1.8.3.min.js"></script>




  <style media="screen">
    html,
    body,
    div,
    p {
      margin: 0
    }

    .common_tit {
      height: 65px;
      background: #d2d2d2;
      line-height: 65px;
      font-size: 17px;
      width: 100%;
    }

    .notBg {
      -moz-user-select: none;
      /*火狐*/
      -webkit-user-select: none;
      /*webkit浏览器*/
      -ms-user-select: none;
      /*IE10*/
      -khtml-user-select: none;
      /*早期浏览器*/
      user-select: none;
      cursor: default;
    }

    .RecBoxIsSelectedSignName,
    .RecBoxIsSelectedOurs,
    .RecBoxIsSelectedOthers {
      position: absolute;
      opacity: 0.5;
    }

    .RecBoxIsSelectedSignName {
      z-index: 3;
      background-color: #f00
    }

    .RecBoxIsSelectedOurs {
      z-index: 4;
      background-color: #0f0
    }

    .RecBoxIsSelectedOthers {
      z-index: 5;
      background-color: #00f
    }

    .btn_box a {
      display: inline-block;
      width: 20px;
      height: 20px;
      line-height: 20px;
      font-size: 16px;
      color: red;
      text-decoration: none;
      text-align: center;
      border: 1px solid red;
    }

    .fixed_btn_top {
      position: absolute;
      left: 0;
      bottom: 0;
      z-index: 10;
      /* height: 40px; */
      /* width: 800px; */
      /* line-height: 40px; */
      /* border: 1px solid #000; */
      /* background: #efefef; */
      margin-top: 20px;
      box-sizing: border-box;
      padding: 0 10px;
    }

    .fixed_btn_left {
      position: absolute;
      right: 0;
      top: 0;
      z-index: 10;
      height: 600px;
      width: 80px;
      line-height: 30px;
      border: 1px solid #000;
      background: #efefef;
      box-sizing: border-box;
      padding: 10px;
    }

    .fixed_btn_left input,
    .fixed_btn_top input {
      width: 90px;
      height: 30px;
      line-height: 28px;
      border-radius: 10px;
      border: 1px solid #00adef;
      text-align: center;
    }

    .wrap {
      padding-right: 80px;
      padding-bottom: 40px;
    }
    .save-btn{
      margin-top: 20px
    }
  </style>
</head>

<body>
  <div class="page-container finance_manage Hui-article-box">
    <div class="tit common_tit">
      <span>预览合同</span>
    </div>
    <div class="title" style="margin-top: 20px">
      <span>合同标题：</span>
      <input type="text" name="" placeholder="房屋租凭合同" style="width:150px" class="input-text">
    </div>
    <form class=" " id=" " method="post" enctype="multipart/form-data">
      <!-- <div class="btn_box fixed_btn_top">
      <input id="SignName" class="sign" type="button" value="印章区域" />&nbsp;
      <a href="javascript:;" id="addSignName" class="SignName">+</a>
      <input id="Ours" class="sign" type="button" value="签名区域" />&nbsp;
      <a href="javascript:;" id="addOurs" class="Ours">+</a>
      <input id="Others" class="sign" type="button" value="签署方名称" />&nbsp;
      <a href="javascript:;" id="addOthers" class="Others">+</a>
      <input id="complete" type="button" value="test4" />&nbsp;
    </div> -->


      <!-- 选取框层-->
      <!--<div id="selectRecBoxSignName" class="RecBoxIsSelectedSignName" style="position:absolute;z-index:3;opacity:0.5;background-color:#f00"></div>-->

      <!--<div id="selectRecBoxOurs" class="RecBoxIsSelectedOurs" style="position:absolute;z-index:4;opacity:0.5;background-color:#0f0"></div>-->

      <!--<div id="selectRecBoxOthers" class="RecBoxIsSelectedOthers" style="position:absolute;z-index:5;opacity:0.5;background-color:#00f"></div>-->

      <!-- 覆盖层-->
      <!-- <div id="mask" style="width:800px;height:600px;background-color:#000;border:1px #000 solid;z-index:2;display:none;position:absolute;opacity:0.2"></div> -->

      <!-- 源内容层-->
      <div class="wrap" style="position: relative;height: 600px;width: 800px;overflow: hidden;margin-top: 20px">
        <!-- 覆盖层-->
        <div class="btn_box fixed_btn_top">
          <input id="SignName" class="sign" type="button" value="印章区域" />&nbsp;
          <a href="javascript:;" id="addSignName" class="SignName">+</a>
          <input id="Ours" class="sign" type="button" value="签名区域" />&nbsp;
          <a href="javascript:;" id="addOurs" class="Ours">+</a>
          <input id="Others" class="sign" type="button" value="签署方名称" />&nbsp;
          <a href="javascript:;" id="addOthers" class="Others">+</a>
          <input id="complete" type="button" value="test4" />&nbsp;
        </div>
        <!-- <div class="btn_box fixed_btn_left">
          <input class="left1" type="button" value="test1" />
          <input class="left1" type="button" value="test2" />
          <input class="left1" type="button" value="test3" />
        </div> -->
        <div id="mask" style="background-color:#000;border:1px #000 solid;z-index:2;display:none;position:absolute;left:0;top:0;opacity:0.2;,filter:alpha(opacity=20);-moz-opacity:0.2;-khtml-opacity: 0.2;overflow: auto"></div>


        <div id="controllHandle" style="width:800px;height:600px;border:1px #000 solid;z-index:2;position:absolute;">

          <div class="content" id="content" style="position: relative;z-index: 3;min-height:600px;">
            <div class="constituency-warp" id="constituency-warp">
              <!-- <div id="selectRecBoxSignName" class="RecBoxIsSelectedSignName" style="position:absolute;z-index:3;opacity:0.5;background-color:#f00"></div> -->

              <!-- <div id="selectRecBoxOurs" class="RecBoxIsSelectedOurs" style="position:absolute;z-index:4;opacity:0.5;background-color:#0f0"></div> -->

              <!-- <div id="selectRecBoxOthers" class="RecBoxIsSelectedOthers" style="position:absolute;z-index:5;opacity:0.5;background-color:#00f"></div> -->
            </div>
            <!-- <div id="selectRecBoxSignName" class="RecBoxIsSelectedSignName" style="position:absolute;z-index:3;opacity:0.5;background-color:#f00"></div> -->

            <!-- <div id="selectRecBoxOurs" class="RecBoxIsSelectedOurs" style="position:absolute;z-index:4;opacity:0.5;background-color:#0f0"></div> -->

            <!-- <div id="selectRecBoxOthers" class="RecBoxIsSelectedOthers" style="position:absolute;z-index:5;opacity:0.5;background-color:#00f"></div> -->

            <!--<p style="word-break: break-word;">{$contractInfo.content}</p>-->

            <p style="text-align: center;word-break: break-word;">
              <span style="font-size: 24px;">
                <strong>{$contractInfo.content}</strong>
              </span>
            </p>

          </div>
        </div>
      </div>
      <input type="hidden" name="sealCoordinate" id="sealCoordinate" value="">
      <input type="hidden" name="sealCoordinateLen" id="sealCoordinateLen" value="">
      <input type="hidden" name="signCoordinate" id="signCoordinate" value="">
      <input type="hidden" name="signCoordinateLen" id="signCoordinateLen" value="">
      <input type="hidden" name="signatoryCoordinate" id="signatoryCoordinate" value="">
      <input type="hidden" name="signatoryCoordinateLen" id="signatoryCoordinateLen" value="">
      <input type="submit" class="btn btn-primary radius save-btn" onClick="return save();" value="保存并提交">
    </form>
  </div>

</body>

</html>

<script>
  var globleft = '';
  var globtop = '';

  var sealCoordinateLen = '';
  var signCoordinateLen = '';
  var signatoryCoordinateLen = '';


  var sealCoordinate = new Array();
  var signCoordinate = new Array();
  var signatoryCoordinate = new Array();

  // $(document).ready(function() {
  $(function () {
    var currentOperation; //用于存放当前操作
    var selectBoxBackGroundColor; // 选择框背景颜色
    var selectBox = new SelectBox(); //申明一个box来存当前操作的选框


    //--初始化三个 用于存放 最终形成的 选框 坐标宽高等数据的 变量 用于传给服务端处理拼合
    var signatoryBox = []; //对应 test1 区域存放
    var senderBox = new Array(); //对应 test2 区域存放
    var signBox = new Array(); //对应 test3 区域存放


    var selected = new Array(); //注册一个选取框 用于 选取操作

    var flag; //申明一个用来预存选取区域的大图

    var isSelecingStart = false; //是否开启选框

    var _isFlag = false; //是否点击过完成按钮，（判断滚动条）

    var _eleFlag = '' //记录当前是选择的那个选框按钮
    // var contAdd = 0; //添加多个DOM元素的唯一值
    var contAdd = [0, 0, 0];

    var newcontAdd = 0; //绘制多个DOM元素的唯一值
    var ttt = false;
    var saveCont = 0

    // setMaskWidth:动态设置遮罩层高宽
    var setMaskWidth = $('#content').innerWidth()
    var setMaskHeight = $('#content').prop('scrollHeight')
    $("#mask").css('width', setMaskWidth)
    $('#mask').css('height', setMaskHeight)

    //-----显示mask
    var btns = $('.btn_box input')
    $.each(btns, function (i, item) {
      $(item).on('click', function () {
        if ($(item).hasClass('clicked')) {
          return
        }
        $(item).addClass('clicked')
        _isFlag = true
        var parentIdName = $(item).attr('id')
        _eleFlag = parentIdName
        //动态创建选择框
        // console.log(contAdd)
        var createBox = appendText('selectRecBox' + parentIdName, 'RecBoxIsSelected' + parentIdName, contAdd[i])
        $('#constituency-warp').append(createBox)

        $('#controllHandle').addClass('notBg')
        if ($("#mask").is(":hidden")) {
          $("#mask").show(); //如果mask为隐藏,则将它显现
        }
        //当前操作
        currentOperation = parentIdName + contAdd[i]; //绘制DOM元素的唯一值
        // console.log(currentOperation);
        selected = [];
        flag = new BigMapObj('mask');
      })
    })

    // 添加
    var aBtn = $('.btn_box a')
    $.each(aBtn, function (i, item) {
      $(item).on('click', function () {
        _isFlag = true
        var parentIdName = $(item).attr('class')
        _eleFlag = parentIdName
        //动态创建选择框

        // contAdd++;
        contAdd[i]++;
        // console.log(contAdd)
        var createBox = appendText('selectRecBox' + parentIdName, 'RecBoxIsSelected' + parentIdName, contAdd[i])
        $('#constituency-warp').append(createBox)

        $('#controllHandle').addClass('notBg')
        if ($("#mask").is(":hidden")) {
          $("#mask").show(); //如果mask为隐藏,则将它显现
        }
        //当前操作
        currentOperation = parentIdName + contAdd[i]; //绘制DOM元素的唯一值
        // console.log(currentOperation);
        selected = [];
        flag = new BigMapObj('mask');
      })
    })
    //-----隐藏mask
    $("#complete").click(function () {
      _isFlag = false
      $('.btn_box input').removeClass('clicked')
      $('#controllHandle').removeClass('notBg')
      if ($("#mask").is(":visible")) {
        $("#mask").hide(); //如果mask为隐藏,则将它显现
      }
    });
    /*
     * 鼠标越界或非法反向操作
     */
    $("#mask").hover(
      function () { //预览框里边
        //console.log("a"); 此空函数不能删
      },
      function () { //预览框外边
        if (isSelecingStart) { //如果选框状态已开启
          selectBox.setEmpty(currentOperation);
          selected = [];
          isSelecingStart = false; //关闭选框状态
        }
      }
    );
    /*
     *滚动条
     */
    $('#mask').scroll(function () {
      console.log('55')
      // console.log($('#controllHandle').scrollTop()+'px')
    });
    /*
     *鼠标按下
     */
    $("#controllHandle").mousedown(function (event) {
      if (_isFlag) {
        isSelecingStart = true; //开启选框状态
        var point = getMousePoint(event); //---获取当前鼠标位置
        // console.log(point)
        if (flag.isCover(point.x, point.y)) {
          selectBox.setStartPoint(point.x, point.y);
          // console.log(point.x, point.y)
        } else {
          selected = [];
        }
      }

    });
    /*
     *鼠标移动
     */
    $("#controllHandle").mousemove(function (event) {
      if (_isFlag) {
        if (isSelecingStart) { //如果选框状态已开启
          var point = getMousePoint(event); //---获取当前鼠标位置
          if (flag.isCover(point.x, point.y)) {
            selectBox.setRect(currentOperation);
            selectBox.setEndPoint(point.x, point.y);
          } else {
            selected = [];
          }
        }
      }
    });
    /*
     *鼠标弹起
     */
    $("#controllHandle").mouseup(function (event) {
      if (_isFlag) {
        if (isSelecingStart) { //如果选框状态已开启
          var point = getMousePoint(event); //---获取当前鼠标位置
          if (flag.isCover(point.x, point.y)) {
            selectBox.setEndPoint(point.x, point.y);
            selectBox.refreshs();
            selectBox.setRect(currentOperation);
            selected = selectBox.getSelected();
          } else {
            selected = [];
          }
          isSelecingStart = false; //关闭选框状态
        }
        if (selected !== "undefined" && selected.length != 0) {

          selected[0] = parseInt(selected[0] - flag.x1);
          selected[1] = parseInt(selected[1] - flag.y1);
          selected[2] = parseInt(selected[2] - flag.x1);
          selected[3] = parseInt(selected[3] - flag.y1);
          // console.log(currentOperation)
          //针对每次不同的添加存储到对应数组内
          var newStr = currentOperation;







          // switch (currentOperation) { // 整个switch 用于 分别存储 不同的 区域
          //   case `SignName${contAdd[0]}`:
          //     var newArrStr = newStr.split('e')[1]
          //     if (`SignName${newArrStr}`) {
          //       signatoryBox[newArrStr] = selected
          //
          //       signatoryBox = clear_arr_trim(signatoryBox);
          //
          //       console.log('第一个:', signatoryBox);
          //       // console.log(signatoryBox.length)
          //       clear_arr_trim(signatoryBox)
          //       var len = signatoryBox.length;
          //       sealCoordinate.push(signatoryBox[len - 1]);
          //       // console.log(signatoryBox[1])
          //       sealCoordinateLen = signatoryBox.length;
          //
          //
          //     }
          //     break;
          //   case `Ours${contAdd[1]}`:
          //     var ourArrStr = newStr.split('s')[1]
          //     if (`Ours${ourArrStr}`) {
          //       senderBox[ourArrStr] = selected
          //       console.log('第二个:', senderBox);
          //       clear_arr_trim(senderBox)
          //
          //
          //       var len = senderBox.length;
          //       signCoordinate.push(senderBox[len - 1]);
          //
          //
          //       signCoordinateLen = senderBox.length;
          //
          //     }
          //     break;
          //   case `Others${contAdd[2]}`:
          //     var otherArrStr = newStr.split('s')[1]
          //     if (`Others${otherArrStr}`) {
          //       signBox[otherArrStr] = selected
          //       console.log('第三个:', signBox);
          //       console.log(signBox.length)
          //
          //       // 去掉空字符串
          //       clear_arr_trim(signBox)
          //
          //       var len = signBox.length;
          //       signatoryCoordinate.push(signBox[len - 1]);
          //
          //       signatoryCoordinateLen = signBox.length;
          //     }
          //     break;
          // }

          switch (currentOperation) { // 整个switch 用于 分别存储 不同的 区域
            case `SignName${contAdd[0]}`:
              var newArrStr = newStr.split('e')[1]
              if (`SignName${newArrStr}`) {
                signatoryBox[newArrStr] = selected
                console.log('第一个:', signatoryBox);;
                clear_arr_trim(selected)
                console.log(selected)
                console.log(signatoryBox.length)

                sealCoordinate.push(signatoryBox[signatoryBox.length - 1]);
                sealCoordinateLen = signatoryBox.length - 1;


              }
              break;
            case `Ours${contAdd[1]}`:
              var ourArrStr = newStr.split('s')[1]
              if (`Ours${ourArrStr}`) {
                senderBox[ourArrStr] = selected
                console.log('第二个:', senderBox);;
                clear_arr_trim(senderBox)
                console.log(senderBox)
                console.log(senderBox.length)

                signCoordinate.push(senderBox[senderBox.length - 1]);
                signCoordinateLen = senderBox.length;
              }
              break;
            case `Others${contAdd[2]}`:
              var otherArrStr = newStr.split('s')[1]
              if (`Others${otherArrStr}`) {
                signBox[otherArrStr] = selected
                console.log('第三个:', signBox);
                clear_arr_trim(signBox)
                console.log(signBox.length)

                signatoryCoordinate.push(signBox[signBox.length - 1]);
                signatoryCoordinateLen = signBox.length;
              }
              break;
          }
          // console.log(signatoryBox);
          // console.log(senderBox);
          // console.log(signBox);
        }

      }

    });


  });

  function clear_arr_trim(array) {
    for (var i = 0; i < array.length; i++) {
      if (array[i] == "" || typeof (array[i]) == "undefined") {
        array.splice(i, 1);
        i = i - 1;
      }
    }
    return array;
    console.log(array)
  }


  // 动态创建(多个dom元素的contAdd值)
  function appendText(IdName, className, contAdd) {
    // contAdd++;
    // console.log(contAdd)
    var cont = "<div id=" + IdName + contAdd + " class=" + className + "></div>"; // 以 HTML 创建新元素
    // $("parent").append(cont); // 追加新元素
    return cont
  }
  /*
   *框选状态的区域对象
   */
  function SelectBox() {
    // console.log(contAdd)
    this.x1 = 0;
    this.y1 = 0;
    this.x2 = 0;
    this.y2 = 0;
    this.left = 0;
    this.width = 0;
    this.top = 0;
    this.height = 0;
    this.setStartPoint = function (x1, y1) {
      this.x1 = x1;
      this.y1 = y1;
      //this.refresh();
    };
    this.setEndPoint = function (x2, y2) {
      this.x2 = x2;
      this.y2 = y2;
      this.refreshs();
    };
    this.setPoint = function (x1, y1, x2, y2) {
      this.setStartPoint(x1, y1);
      this.setEndPoint(x2, y2);
      this.refreshs();
      console.log(this.x1);
    };
    this.refreshs = function () {
      if (this.x2 >= this.x1) {
        this.left = parseInt(this.x1);
        this.width = parseInt(this.x2 - this.x1);
      } else {
        this.left = parseInt(this.x2);
        this.width = parseInt(this.x1 - this.x2);
      }
      if (this.y2 >= this.y1) {
        this.top = parseInt(this.y1);
        this.height = parseInt(this.y2 - this.y1);
      } else {
        this.top = parseInt(this.y2);
        this.height = parseInt(this.y1 - this.y2);
      }
    };
    this.setRect = function (currentOperation) {
      // console.log(contAdd)
      // console.log($('#selectRecBox1' + currentOperation));
      // console.log(newcontAdd+=1)
      $('#selectRecBox' + currentOperation).css({
        'top': this.top,
        'left': this.left,
        'height': this.height,
        'width': this.width
      });
      // console.log('dfdfdf');
    };
    this.setEmpty = function (currentOperation) {
      $('#selectRecBox' + currentOperation).css({
        'top': 0,
        'left': 0,
        'height': 0,
        'width': 0
      });
    }
    this.getSelected = function () {
      if (this.x2 >= this.x1) {
        var startX = this.x1;
        var endX = this.x2;
      } else {
        var startX = this.x2;
        var endX = this.x1;
      }
      if (this.y2 >= this.y1) {
        var startY = this.y1;
        var endY = this.y2;
      } else {
        var startY = this.y2;
        var endY = this.y1;
      }
      var selected = new Array();
      selected[0] = startX;
      selected[1] = startY;
      selected[2] = endX;
      selected[3] = endY;
      return selected;
    };
  }
  /*
   *获取当前控件位置
   */
  function getCurrentElementPosition(elementId) {
    this.offset = $('#' + elementId).offset();
    this.width = $('#' + elementId).width();
    this.height = $('#' + elementId).height();
    var container = {
      top: this.offset.top,
      left: this.offset.left,
      width: this.width,
      height: this.height
    };

    return container;
  }
  /*
   *框选区域对象合法性判断
   */
  function BigMapObj(elementId) {
    this.currentContractPosition = getCurrentElementPosition(elementId); //获取预览区域位置坐标和宽高
    this.x1 = this.currentContractPosition.left; //大图的起点X
    this.y1 = this.currentContractPosition.top; //大图的起点Y
    this.x2 = this.x1 + this.currentContractPosition.width; //大图的终点X
    this.y2 = this.y1 + this.currentContractPosition.height; //大图的终点Y
    //判断点(x,y)是否在合法区域内
    this.isCover = function (x, y) {
      var inside = false;
      if (this.x1 < x && x < this.x2) {
        if (this.y1 < y && y < this.y2) {
          inside = true;
        }
      }
      return inside;
    };
  }
  /*
   *获取鼠标位置
   */
  function getMousePoint(ev) {
    //获取
    var div = document.getElementById("mask");
    var e = event || window.event;
    var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
    var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
    var x = e.pageX || e.clientX + scrollX;
    var y = e.pageY || e.clientY + scrollY;
    //alert('x: ' + x + '\ny: ' + y);
    //获取元素的滚动Y坐标
    var YY = $('#controllHandle').scrollTop() - 40;
    var objtop = $('#controllHandle').offset().top;
    var objleft = $('#controllHandle').offset().left;
    // console.log(x, y + YY);

    // console.log(objleft);
    // console.log(objtop);

    globleft = objleft;
    globtop = objtop;

    // 定义鼠标在视窗中的位置
    var point = {
      x: 0,
      y: 0
    };
    point.x += x - objleft;
    point.y += y + YY - objtop;
    // point.x=event.clientX+document.body.scrollLeft||document.documentElement.scrollLeft;
    // point.y = event.clientY+document.body.scrollTop||document.documentElement.scrollTop;
    // 如果浏览器支持 pageYOffset, 通过 pageXOffset 和 pageYOffset 获取页面和视窗之间的距离
    // if (typeof window.pageYOffset != 'undefined') {
    // 	point.x = window.pageXOffset;
    // 	point.y = window.pageYOffset;
    // }
    // 如果浏览器支持 compatMode, 并且指定了 DOCTYPE, 通过 documentElement 获取滚动距离作为页面和视窗间的距离
    // IE 中, 当页面指定 DOCTYPE, compatMode 的值是 CSS1Compat, 否则 compatMode 的值是 BackCompat
    // else if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {
    // 	point.x = document.documentElement.scrollLeft;
    // 	point.y = document.documentElement.scrollTop;
    // }
    // 如果浏览器支持 document.body, 可以通过 document.body 来获取滚动高度
    // else if (typeof document.body != 'undefined') {
    // 	point.x = document.body.scrollLeft;
    // 	point.y = document.body.scrollTop;
    // }
    // 加上鼠标在视窗中的位置
    // point.x += ev.clientX;
    // point.y += ev.clientY;
    // 返回鼠标在视窗中的位置
    return point;
  }
  /*
   *判断两个class 属性的  div有没有交集
   */
  function isOverlapped(ClassOne, ClassTwo) {
    var objOne = $('.' + ClassOne);
    var objTwo = $('.' + ClassTwo);
    var objOneOffset = objOne.offset();
    var objTwoOffset = objTwo.offset();
    //对象一横向，纵向最大值，起点
    var maxXOne = objOneOffset.left + objOne.width();
    var maxYOne = objOneOffset.top + objOne.height();
    var xOne = objOneOffset.left;
    var yOne = objOneOffset.top;
    //对象二横向，纵向最大值，起点
    var maxXTwo = objTwoOffset.left + objTwo.width();
    var maxYTwo = objTwoOffset.top + objTwo.height();
    var xTwo = objTwoOffset.left;
    var yTwo = objTwoOffset.top;
    //将所的X Y轴上的值放入数据中，排序取得各自中间值。
    var xArray = Array();
    xArray[0] = xOne;
    xArray[1] = xTwo;
    xArray[2] = maxXOne;
    xArray[3] = maxXTwo;
    xArray.sort(function (a, b) {
      return a > b ? 1 : -1
    });
    var yArray = Array();
    yArray[0] = yOne;
    yArray[1] = yTwo;
    yArray[2] = maxYOne;
    yArray[3] = maxYTwo;
    yArray.sort(function (a, b) {
      return a > b ? 1 : -1
    });
    if (xOne == xTwo && yOne == yTwo) {
      return true;
    }
    //得到X轴上的中值
    var mXV = (xArray[1] + xArray[2]) / 2;
    //得到Y轴上的中间值
    var mYV = (yArray[1] + yArray[2]) / 2;
    var xVar = mXV >= xOne && mXV <= maxXOne && mXV >= xTwo && mXV <= maxXTwo;
    var yVar = mYV >= yOne && mYV <= maxYOne && mYV >= yTwo && mYV <= maxYTwo;
    if (xVar && yVar) {
      return true;
    } else {
      return false;
    }
  }


  function save() {
    var name = $('#name').val();
    console.log(sealCoordinate);
    // return false;

    $("input[name='sealCoordinate']").attr("value", sealCoordinate);
    $("input[name='signCoordinate']").attr("value", signCoordinate);
    $("input[name='signatoryCoordinate']").attr("value", signatoryCoordinate);

    $("input[name='sealCoordinateLen']").attr("value", sealCoordinateLen);
    $("input[name='signCoordinateLen']").attr("value", signCoordinateLen);

    $("input[name='signatoryCoordinateLen']").attr("value", signatoryCoordinateLen);



  }
</script>